package com.controller;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.mapper.PersonMapper;
import com.po.Person;
import com.service.PersonService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import net.sf.json.JSONArray;

@RestController
@Api(tags = "1.1", description = "用户管理", value = "用户管理")
public class TestController {

	@Autowired
	private PersonService personService;

	@Autowired
	private PersonMapper PersonMapper;

	@ApiOperation(value = "条件查询")
	@GetMapping("/findByName")
	public String findByName() {
		List<Person> list = PersonMapper.findByName("张三");
		return JSONArray.fromObject(list).toString();
	}

	@RequestMapping("/findByDev")
	public String findByDev() {
		List<Person> list = personService.find();
		return JSONArray.fromObject(list).toString();
	}
}
